Make tools/Makefile cross-friendly
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 22 Jan 2008 09:43:53 +0000 (09:43 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 22 Jan 2008 09:43:53 +0000 (09:43 +0000)
Pass Xen cross-compilation options through to ioemu.
Export CROSS_SYS_ROOT for use by scripts.  Unexport
IOEMU_DIR since it isn't used outside of the Makefile.

Signed-off-by: Aron Griffis <aron@hp.com>
tools/Makefile

index f023fbb500bc3056b704a20371990831a7d61801..14abf6026d7ded8f035b953f7660bc20d953b87b 100644 (file)
@@ -28,6 +28,12 @@ SUBDIRS-$(PYTHON_TOOLS) += python
 SUBDIRS-$(PYTHON_TOOLS) += pygrub
 endif
 
+# For the sake of linking, set the sys-root
+ifneq ($(CROSS_COMPILE),)
+CROSS_SYS_ROOT ?= /usr/$(CROSS_COMPILE:-=)/sys-root
+export CROSS_SYS_ROOT
+endif
+
 .PHONY: all
 all: check
        @set -e; for subdir in $(SUBDIRS-y); do \
@@ -65,10 +71,15 @@ check_clean:
 
 .PHONY: ioemu ioemuinstall ioemuclean
 ifeq ($(CONFIG_IOEMU),y)
-export IOEMU_DIR ?= ioemu
+IOEMU_DIR ?= ioemu
+ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
+IOEMU_CONFIGURE_CROSS ?= --cross-prefix=$(CROSS_COMPILE) \
+                        --interp-prefix=$(CROSS_SYS_ROOT)
+endif
 ioemu ioemuinstall:
        [ -f $(IOEMU_DIR)/config-host.mak ] || \
-         (cd $(IOEMU_DIR) && sh configure --prefix=/usr)
+         ( cd $(IOEMU_DIR) && sh configure --prefix=/usr \
+               $(IOEMU_CONFIGURE_CROSS) )
        $(MAKE) -C $(IOEMU_DIR) $(patsubst ioemu%,%,$@)
 ioemuclean:
        $(MAKE) -C $(IOEMU_DIR) distclean